/**
 * ---------------- 定义所有菜单项 ----------------
 */
import { defineMenu } from './router-util'
/**
 * 菜单所有属性：
 * {
 * 	id: 'role',		        // 菜单id, 必须唯一 [必填]
 * 	title: '用户中心',		// 菜单名称, 同时也是tab选项卡上显示的名称 [必填]
 * 	icon: 'el-icon-user',	// 菜单图标, 参考地址:  https://element-plus.org/zh-CN/component/icon.html#icon-collection
 * 	info: '管理所有用户',	    // 菜单详细介绍, 在菜单预览和分配权限时会有显示
 * 	path: '/role-list',	    // 菜单path，如果不写，则根据id生成
 * 	show: 'yes',			// 菜单是否显示, 取值：yes=永远显示，no=永远不显示，auth=根据权限决定是否显示，默认auth
 * 	auth: true,             // 是否需要鉴权，默认true，此值为true时，在导航守卫里需要鉴权才可通过，为 false 时将无条件通过
 * 	component: 'vue组件',    // 菜单对应的 vue 组件，
 * 	parentId: 1,			// 所属父菜单id, 如果指定了一个值, 框架在初始化时会将此菜单转移到指定菜单上
 * 	url: '',		        // 菜单url，如果指定了此值，则通过 iframe 打开页面视图
 * 	isBlank: false,		    // 是否属于外部链接, 如果为true, 则点击菜单时从新窗口打开（只在url有值时此属性才会生效）
 * 	click: function(){}		// 如果指定了此值，则点击菜单时执行一个函数
 * 	children: [			    // 指定这个菜单所有的子菜单, 子菜单可以继续指定子菜单, 至多支持四级菜单
 * 		// ....
 * 	],
 * }
 */

/**
 * 定义动态路由表：需要展现在菜单栏上的路由
 */

export const perList = [
  'home',
  'store',
  'store-wait-consultation',
  'store-medical-record',
  'prescription',
  'prescription-record',
  'sign',
  'elect-sign',
  'account',
  'income-list',
  'withdrawal-list',
  // 系统管理员
  'org-manage',
  'org-list',
  'depart-list',
  'doctor-list',
  'store-manage',
  'store-list',
  'pharmacist-list',
  'medicine-manage',
  'west-medicine',
  'Chinese-medicine',
  'system',
  'notice',
  'user-manage',
  'outpatient',
  'outpatient-prescribing',
   
  'sys-user',
  'sys-user-list',
  'sys-user-list-gc',
  'sys-login-log',
  'console-plate',
  'sys-client',
  'sys-client-list',
  'sys-client-add',
  'sys-client-visit',
  'sys-user-online',
  'sys-user-online-list',

  // 'mall-center',
  // 'goods-list',
  // 'order-list',
  // 'online-order-list',
  // 'offline-order-list',
  // 'create-order',
  // 'pay-order',
  // 'medicine',
  // 'medicine-list',
  // 'store-list',
  // 'finance',
  // 'merchant-bill',
  // 'company-bill',
  // 'enterprise-fund-list',
  // 'claim-detail',
  // 'insurance-claims',
  // 'claims-list',
  // 'bas',
  // 'root',
  // 'in-system',
  // 'auth',
  // 'role-list',
  // 'menu-list',
  // 'admin-list',
  // 'admin-add',
  // 'sp-admin-login',
  // 'console',
  // 'redis-console',
  // 'apilog-list',
  // 'sql-console',
  // 'form-generator',
  // 'sys-vc-log',
  
  // 'sys-message',
  // 'sys-message-list',
  // 'sp-config',
  // 'config-view-info',
  // 'config-view-server',
  // 'config-view-sync-user',
  // 'config-view-vc-setting',
  // 'sp-config-list',
  // 'sys-open',
  // 'sys-open-client',
  // 'sys-open-client-apply',
  // 'sys-open-scope',
  // 'sys-open-scope-apply',
  // 'sys-open-auth-data',
  // 'sys-open-auth-log',
  // 'config-view-open-setting',
]
export const getRoleMenu = function (role) {
  /* 
    RoleId 角色标识（0、NoPermission无权限 admin系统管理员 doctor医师 ）
    */
  const roleMenu = {
    /* 管理员 */
    SuperAdmin: defineMenu([
      {
        id: 'home',
        title: '工作台',
        component: () => import('@/sp-views/home/index.vue'),
      },
      
      {
        id: 'org-manage',
        title: '医疗机构管理',
        icon: 'el-icon-OfficeBuilding',
        children: [
          { id: 'org-list', title: '机构管理', component: () => import('@/views/org-manage/org-list.vue') },
          { id: 'depart-list', title: '科室管理', component: () => import('@/views/depart-manage/depart-list.vue') },
          { id: 'doctor-list', title: '医师管理', component: () => import('@/views/doctor-manage/doctor-list.vue') },
        ],
      },
      {
        id: 'store-manage',
        title: '定点药店管理',
        icon: 'el-icon-Shop',
        children: [
          { id: 'store-list', title: '药店管理', component: () => import('@/views/store-manage/store-list.vue') },
          { id: 'pharmacist-list', title: '药师管理', component: () => import('@/views/pharmacist-manage/pharmacist-list.vue') },
        ],
      },
      // {
      //   id: 'store',
      //   title: '问诊管理',
      //   icon: 'el-icon-User',
      //   children: [
      //     { id: 'store-medical-record', title: '就诊历史', component: () => import('@/views/store/medical-record.vue') },
      //   ],
      // },
      
      // {
      //   id: 'sign',
      //   title: '签字管理',
      //   icon: 'el-icon-EditPen',
      //   children: [{ id: 'elect-sign', title: '电子签名', component: () => import('@/views/sign/elect-sign.vue') }],
      // },
      {
        id: 'store',
        title: '问诊管理',
        icon: 'el-icon-FirstAidKit',
        children: [
          // { id: 'store-wait-consultation', title: '待接诊', component: () => import('@/views/store/wait-consultation.vue') },
          { id: 'store-medical-record', title: '就诊历史', component: () => import('@/views/store/medical-record.vue') },
        ],
      },
      {
        id: 'prescription',
        title: '处方管理',
        icon: 'el-icon-DocumentAdd',
        children: [{ id: 'prescription-record', title: '历史处方', component: () => import('@/views/prescription/prescription-record.vue') }],
      },
      {
        id: 'system',
        title: '系统设置',
        icon: 'el-icon-Setting',
        children: [
          { id: 'notice', title: '通知公告', component: () => import('@/views/notice/notice-list.vue') },
        ],
      },
    ]),
    /* 医师 */
    DoctorAdmin: defineMenu([
      {
        id: 'home',
        title: '工作台',
        icon: 'el-icon-House',
        component: () => import('@/sp-views/home/index.vue'),
      },
      {
        id: 'outpatient',
        title: '门诊',
        icon: 'el-icon-ChatSquare',
        children: [
          { id: 'outpatient-prescribing', title: '开处方', component: () => import('@/views/outpatient/prescribing.vue') },
        ],
      },
      {
        id: 'store',
        title: '药店接问诊',
        icon: 'el-icon-FirstAidKit',
        children: [
          { id: 'store-wait-consultation', title: '待接诊', component: () => import('@/views/store/wait-consultation.vue') },
          { id: 'store-medical-record', title: '就诊历史', component: () => import('@/views/store/medical-record.vue') },
        ],
      },
      {
        id: 'prescription',
        title: '处方管理',
        icon: 'el-icon-DocumentAdd',
        children: [{ id: 'prescription-record', title: '历史处方', component: () => import('@/views/prescription/prescription-record.vue') }],
      },
      {
        id: 'sign',
        title: '签字管理',
        icon: 'el-icon-EditPen',
        children: [{ id: 'elect-sign', title: '电子签名', component: () => import('@/views/sign/elect-sign.vue') }],
      },
      // {
      //   id: 'account',
      //   title: '我的账户', 
      //   icon: 'el-icon-CreditCard',
      //   info: '我的账户',
      //   children: [
      //     { id: 'income-list', title: '收入明细', component: () => import('@/views/account/income-list.vue') },
      //     { id: 'withdrawal-list', title: '提现记录', component: () => import('@/views/account/withdrawal-list.vue') },
      //   ],
      // },
    ]),
    /* 机构管理员 */
    FixmedinsAdmin: defineMenu([
      {
        id: 'home',
        title: '工作台',
        component: () => import('@/sp-views/home/index.vue'),
      },
      {
        id: 'depart-list',
        title: '科室管理',
        icon: 'el-icon-OfficeBuilding',
        component: () => import('@/views/depart-manage/depart-list.vue') 
      },
      {
        id: 'doctor-list',
        title: '医师管理',
        icon: 'el-icon-Shop',
        component: () => import('@/views/doctor-manage/doctor-list.vue')
      },
      {
        id: 'org-list',
        title: '机构管理',
        icon: 'el-icon-DocumentAdd',
        component: () => import('@/views/org-manage/org-list.vue')
      },
      {
        id: 'user-manage',
        title: '用户管理',
        icon: 'el-icon-User',
        component: () => import('@/views/user-manage/user-center.vue')
      },
    ]),
    /* 药店管理员 */
    DrugstoreAdmin: defineMenu([
      {
        id: 'home',
        title: '工作台',
        component: () => import('@/sp-views/home/index.vue'),
      },
      {
        id: 'medicine-manage',
        title: '药品管理',
        icon: 'el-icon-Box',
        children: [
          { id: 'west-medicine', title: '西药中成药', component: () => import('@/views/medicine-manage/west/medicine-list.vue') },
          { id: 'Chinese-medicine', title: '中药饮片', component: () => import('@/views/medicine-manage/Chinese/medicine-list.vue') },
        ],
      },
      {
        id: 'doctor-list',
        title: '医师管理',
        icon: 'el-icon-Shop',
        component: () => import('@/views/doctor-manage/doctor-list.vue')
      },
      { id: 'pharmacist-list', title: '药师管理', icon: 'el-icon-DocumentAdd', component: () => import('@/views/pharmacist-manage/pharmacist-list.vue') },
      {
        id: 'prescription',
        title: '处方管理',
        icon: 'el-icon-DocumentAdd',
        children: [{ id: 'prescription-record', title: '历史处方', component: () => import('@/views/prescription/prescription-record.vue') }],
      },
      {
        id: 'user-manage',
        title: '用户管理',
        icon: 'el-icon-User',
        component: () => import('@/views/user-manage/user-center.vue')
      }
    ]),
    
  }
  return roleMenu[role] || []
}
export const menuList = defineMenu([
  {
    id: 'home',
    title: '工作台',
    component: () => import('@/sp-views/home/index.vue'),
  },
  {
    id: 'store',
    title: '药店接问诊',
    icon: 'el-icon-FirstAidKit',
    children: [
      { id: 'store-wait-consultation', title: '待接诊', component: () => import('@/views/store/wait-consultation.vue') },
      { id: 'store-medical-record', title: '就诊历史', component: () => import('@/views/store/medical-record.vue') },
    ],
  },
  {
    id: 'prescription',
    title: '处方管理',
    icon: 'el-icon-DocumentAdd',
    children: [{ id: 'prescription-record', title: '历史处方', component: () => import('@/views/prescription/prescription-record.vue') }],
  },
  {
    id: 'sign',
    title: '签字管理',
    icon: 'el-icon-EditPen',
    children: [{ id: 'elect-sign', title: '电子签名', component: () => import('@/views/sign/elect-sign.vue') }],
  },
  {
    id: 'account',
    title: '我的账户', 
    icon: 'el-icon-CreditCard',
    info: '我的账户',
    children: [
      { id: 'income-list', title: '收入明细', component: () => import('@/views/account/income-list.vue') },
      { id: 'withdrawal-list', title: '提现记录', component: () => import('@/views/account/withdrawal-list.vue') },
    ],
  },
])

// console.log(menuList)
